package com.tensquare.article.dao;

import com.tensquare.article.pojo.Article;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by WF on 2019/9/18 11:14
 */
public interface ArticleDao extends JpaRepository<Article,String> {

    //1.审核文章
    @Modifying
    @Query(nativeQuery = true,value="update tb_article set state=1 where id=?1")
    void examine(String articleId);
    //2.文章点赞
    @Modifying
    @Query(nativeQuery = true,value="update tb_article set thumbup=thumbup+1 where id=?1")
    void thumbup(String articleId);
}
